package model 
{
	import com.adobe.images.PNGEncoder;
	import flash.display.BitmapData;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.net.FileReference;
	import flash.utils.ByteArray;
	
	/**
	 * 处理
	 * @author	Meathill
	 * @version	0.1(2011-04-02)
	 */
	public class pngSaver extends EventDispatcher
	{
		private var _file:FileReference;
		private var _data:ByteArray;
		
		public function pngSaver() 
		{
			init();
		}
		
		/************
		 * functions
		 * *********/
		private function init():void {
			_file = new FileReference();
		}
		
		/************
		 * methods
		 * *********/
		public function save(bmpd:BitmapData):void {
			_data = PNGEncoder.encode(bmpd);
			_file.save(_data, 'test.png');
		}
	}
}